<template>
	<view>
		<!-- 顶部滚动条 -->
		<uni-section  >
					<uni-notice-bar show-icon scrollable
						text="用心挑选每一种养老药品，为父母的健康筑起坚固的防线，让他们享受无忧无虑的金色年华。选择高品质的养老药品，不仅是为了父母的身体健康，更是为了他们心灵的安宁，让爱与关怀伴随每一个温馨的瞬间。" />
		</uni-section>
		<!-- 健康信息表单 -->
		<uni-section title="老人基本信息" type="line"  >
					<view class="example">
						<!-- 基础用法，不包含校验规则 -->
						<uni-forms ref="baseForm" :modelValue="selectAssessmentForm">
							<uni-forms-item label="姓名" required>
								<uni-easyinput type="text"  v-model="selectAssessmentForm.username"  />
							</uni-forms-item> 
							<uni-forms-item label="评估人" required>
								<uni-easyinput type="text"  v-model="selectAssessmentForm.emp_id"  />
							</uni-forms-item>
							<uni-forms-item label="血压状态" required>
								<uni-easyinput v-model="selectAssessmentForm.BP" />
							</uni-forms-item>
							<uni-forms-item label="心脏疼痛状况" required>
								<uni-easyinput v-model="selectAssessmentForm.CP" />
							</uni-forms-item>
							<uni-forms-item label="空腹血糖" required>
								<uni-easyinput type="text"  v-model="selectAssessmentForm.FBS"  />
							</uni-forms-item>
							<uni-forms-item label="心脏病检测结果" required>
								<uni-easyinput type="text"  v-model="selectAssessmentForm.NUM"  />
							</uni-forms-item>
							<uni-forms-item label="心率" required>
								<uni-easyinput type="text"  v-model="selectAssessmentForm.HR"  />
							</uni-forms-item>
							<uni-forms-item label="评估结果" required>
								<uni-easyinput type="text"  v-model="selectAssessmentForm.assessment_result"  />
							</uni-forms-item>
						</uni-forms>
					</view>
				</uni-section>
				
	</view>
</template>

<script>
import axios from 'axios';
	export default {
		data() {
			return {
				// 基础表单数据
				selectAssessmentForm: {
					id:'129',
				username: '张三',
				emp_id:'zhang',
				BP:'血压票高',
				CP: '无异常',
				FBS:'>120mg/dl',
				NUM:'1类心脏病',
				HR:'120',
				assessment_result:'轻度失能'
				},
			}
		},
		methods: {
      // async fetchHealthInfoById(id) {
      //   try {
      //     const apiUrl = 'http://localhost:8080/v1/health/addAssessment/selectDetail/';
      //     const response = await axios.get(apiUrl, { params: { id } });
      //     if (response.data) {
      //       this.selectAssessmentForm = response.data;
      //     } else {
      //       console.warn('No data received from the server');
      //     }
      //   } catch (error) {
      //     console.error('Error fetching health info:', error);
      //     alert('无法获取健康信息，请稍后再试。');
      //   }
      // }
    },
    // created() {
    //   // 假设 id 从某个地方获取，例如路由参数
    //   const id = this.$route.params.id || 1; // 默认值为 1，确保有值
    //   this.fetchHealthInfoById(id);
    // }
  };
	
</script>

<style>

</style>
